package com.loong.game2048.util;

/**
 * @author lyx
 * @date 2020/5/19 21:51
 */
public class StrUtils {

    /**
     * 字符的转义
     * @param str 传进来的字符串
     * @return 转移后的字符串
     */
    public static String HTMLEncod(String str) {
        String getStr = str;
        getStr = getStr.replace("<", "&lt;");
        getStr = getStr.replace(">", "&gt;");
        getStr = getStr.replace("&", "and");
        getStr = getStr.replace(":", "&quot;");
        getStr = getStr.replace("%", "&nbsp;");
        getStr = getStr.replace("傻逼", "**");
        getStr = getStr.replace("煞笔", "**");
        getStr = getStr.replace("沙雕", "**");
        return getStr;
    }

    /**
     * 判断字符串是否为空
     * @param str 传进的字符串
     * @return 真假
     */
    public static boolean strIsEmpty(String str){
        if (null==str||str.equals("")){
            return true;
        }
        return false;
    }

}
